package tt.dz.egobus.servicemanager.core.filter;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.URL;

/**
 * @author Anson
 * @date 17-4-20
 * @name 通过文件是否存在进行判断处理
 * @since 1.0.4
 */
public class FileExistCorsEnable implements CorsEnable {
    private static final Logger LOGGER = LoggerFactory.getLogger(FileExistCorsEnable.class);

    private static final String CORS_PATH_FLAG = "/cors.filter";

    @Override
    public boolean isEnable() {
        URL url = CrossDomainFilter.class.getResource(CORS_PATH_FLAG);
        return !(url == null || StringUtils.isEmpty(url.getPath()));
    }
}
